package com.fy.dao;

import com.fy.entity.U_en;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface U_enMapper {
    @Select("select * from u_en")
    List<U_en> findAll();

    @Select("select *from u_en where info_id=#{info_id}")
    List<U_en> getInfo(@Param("info_id") String info_id);

    @Insert("insert into u_en(en_id,ac_id ,info_id, name, tel) VALUES (#{en_id},#{ac_id},#{info_id},#{name},#{tel})")
    int insert(@Param("en_id") String en_id, @Param("ac_id") String ac_id,
               @Param("info_id") String info_id,
               @Param("name") String name, @Param("tel") String tel);

    @Update("update u_en set name=#{name},tel=#{tel} where info_id=#{info_id} and ac_id=#{ac_id}")
    int update(@Param("name") String name, @Param("tel") String tel, @Param("info_id") String info_id, @Param("ac_id") String ac_id);

    @Delete("delete from u_en where info_id=#{info_id} and ac_id=#{ac_id}")
    int delete(@Param("info_id") String info_id, @Param("ac_id") String ac_id);

    @Select("select ac_id FROM u_en where info_id=#{info_id}")
    List<String> getAcIdByInfoId(@Param("info_id") String info);


}